﻿@page "/tables/filter"

<h3>@FilterLocalizer["Title"]</h3>

<h4>@FilterLocalizer["Desc"]</h4>

<ul class="ul-demo mt-3">
    <li>@((MarkupString)FilterLocalizer["DescLi1"].Value)</li>
    <li>@((MarkupString)FilterLocalizer["DescLi2"].Value)</li>
</ul>

<DemoBlock Title="@FilterLocalizer["FilterableTitle"]" Introduction="@FilterLocalizer["FilterableIntro"]" Name="Filterable">
    <p>@((MarkupString)FilterLocalizer["FilterableP"].Value)</p>
    <ul class="ul-demo mb-3">
        <li>@((MarkupString)FilterLocalizer["FilterableLi1"].Value)</li>
        <li>@((MarkupString)FilterLocalizer["FilterableLi2"].Value)</li>
        <li>@((MarkupString)FilterLocalizer["FilterableLi3"].Value)</li>
        <li>@((MarkupString)FilterLocalizer["FilterableLi4"].Value)</li>
    </ul>
    <div>@((MarkupString)FilterLocalizer["FilterableDiv"].Value)</div>
    <Alert ShowBar="true" Color="Color.Info" class="mt-3">@((MarkupString)FilterLocalizer["FilterableAlert"].Value)</Alert>
    <Table TItem="Foo"
           IsPagination="true" PageItemsSource="@PageItemsSource"
           IsStriped="true" IsBordered="true" IsMultipleSelect="true"
           ShowSkeleton="true"
           OnQueryAsync="@OnQueryAsync">
        <TableColumns>
            <TableColumn @bind-Field="@context.DateTime" Width="180" Sortable="true" Filterable="true" />
            <TableColumn @bind-Field="@context.Name" Width="100" Sortable="true" Filterable="true" />
            <TableColumn @bind-Field="@context.Address" Sortable="true" Filterable="true" />
            <TableColumn @bind-Field="@context.Complete" Width="100" Sortable="true" Filterable="true" />
            <TableColumn @bind-Field="@context.Education" Width="100" Sortable="true" Filterable="true" />
            <TableColumn @bind-Field="@context.Count" Width="100" Sortable="true" Filterable="true" />
        </TableColumns>
    </Table>
</DemoBlock>

<DemoBlock Title="@FilterLocalizer["FilterTemplateTitle"]" Introduction="@FilterLocalizer["FilterTemplateIntro"]" Name="FilterTemplate">
    <p>@((MarkupString)FilterLocalizer["FilterTemplateP", ComponentSourceCodeUrl].Value)</p>
    <Table TItem="Foo"
           IsPagination="true" PageItemsSource="@PageItemsSource"
           IsStriped="true" IsBordered="true" IsMultipleSelect="true"
           ShowSkeleton="true"
           OnQueryAsync="@OnQueryAsync">
        <TableColumns>
            <TableColumn @bind-Field="@context.DateTime" Width="180" Sortable="true" Filterable="true" />
            <TableColumn @bind-Field="@context.Name" Width="100" Sortable="true" Filterable="true" />
            <TableColumn @bind-Field="@context.Address" Sortable="true" Filterable="true" />
            <TableColumn @bind-Field="@context.Complete" Width="100" Sortable="true" Filterable="true">
                <Template Context="value">
                    <Checkbox Value="@value.Value" IsDisabled="true"></Checkbox>
                </Template>
            </TableColumn>
            <TableColumn @bind-Field="@context.Count" Width="100" Sortable="true" Filterable="true">
                <FilterTemplate>
                    <CustomerFilter></CustomerFilter>
                </FilterTemplate>
            </TableColumn>
        </TableColumns>
    </Table>
</DemoBlock>

<DemoBlock Title="@FilterLocalizer["ShowFilterHeaderTitle"]" Introduction="@FilterLocalizer["ShowFilterHeaderIntro"]" Name="ShowFilterHeader">
    <Table TItem="Foo"
           IsPagination="true" PageItemsSource="@PageItemsSource"
           IsStriped="true" IsBordered="true" IsMultipleSelect="true"
           ShowSkeleton="true" ShowFilterHeader="true"
           OnQueryAsync="@OnQueryAsync">
        <TableColumns>
            <TableColumn @bind-Field="@context.DateTime" Width="180" Sortable="true" />
            <TableColumn @bind-Field="@context.Name" Width="100" Sortable="true" />
            <TableColumn @bind-Field="@context.Address" Sortable="true" />
            <TableColumn @bind-Field="@context.Complete" Width="100" Sortable="true" Filterable="true" />
            <TableColumn @bind-Field="@context.Education" Width="100" Sortable="true" Filterable="true" />
            <TableColumn @bind-Field="@context.Count" Width="100" Sortable="true" DefaultSort="true" DefaultSortOrder="@SortOrder.Desc" />
        </TableColumns>
    </Table>
</DemoBlock>

<DemoBlock Title="@FilterLocalizer["DefaultSortTitle"]" Introduction="@FilterLocalizer["DefaultSortIntro"]" Name="DefaultSort">
    <ul class="ul-demo mb-3">
        <li>@((MarkupString)FilterLocalizer["DefaultSortLi1"].Value)</li>
        <li>@((MarkupString)FilterLocalizer["DefaultSortLi2"].Value)</li>
    </ul>
    <p>@FilterLocalizer["DefaultSortP"]</p>
    <Table TItem="Foo"
           IsPagination="true" PageItemsSource="@PageItemsSource"
           IsStriped="true" IsBordered="true" IsMultipleSelect="true"
           ShowSkeleton="true"
           OnQueryAsync="@OnQueryAsync">
        <TableColumns>
            <TableColumn @bind-Field="@context.DateTime" Width="180" Sortable="true" />
            <TableColumn @bind-Field="@context.Name" Width="100" Sortable="true" />
            <TableColumn @bind-Field="@context.Address" Sortable="true" />
            <TableColumn @bind-Field="@context.Count" Width="100" Sortable="true" DefaultSort="true" DefaultSortOrder="@SortOrder.Desc" />
        </TableColumns>
    </Table>
</DemoBlock>

<DemoBlock Title="@FilterLocalizer["SortListTitle"]" Introduction="@FilterLocalizer["SortListIntro"]" Name="SortString">
    <p>@((MarkupString)FilterLocalizer["SortListP"].Value)</p>
    <Table TItem="Foo"
           IsPagination="true" PageItemsSource="@PageItemsSource"
           IsStriped="true" IsBordered="true" IsMultipleSelect="true"
           ShowSkeleton="true" SortString="SortList"
           OnQueryAsync="@OnQueryAsync">
        <TableColumns>
            <TableColumn @bind-Field="@context.DateTime" Width="180" Sortable="true" />
            <TableColumn @bind-Field="@context.Name" Width="100" Sortable="true" />
            <TableColumn @bind-Field="@context.Address" Sortable="true" />
            <TableColumn @bind-Field="@context.Count" Width="100" Sortable="true" />
        </TableColumns>
    </Table>
</DemoBlock>

<DemoBlock Title="@FilterLocalizer["OnSortTitle"]" Introduction="@FilterLocalizer["OnSortIntro"]" Name="OnSort">
    <p>@((MarkupString)FilterLocalizer["OnSortP"].Value)</p>
    <Table TItem="Foo"
           IsPagination="true" PageItemsSource="@PageItemsSource"
           IsStriped="true" IsBordered="true" IsMultipleSelect="true"
           ShowSkeleton="true" SortString="@SortString" OnSort="OnSort"
           OnQueryAsync="@OnQueryAsync">
        <TableColumns>
            <TableColumn @bind-Field="@context.DateTime" Width="180" Sortable="true" />
            <TableColumn @bind-Field="@context.Name" Width="100" Sortable="true" />
            <TableColumn @bind-Field="@context.Address" Sortable="true" />
            <TableColumn @bind-Field="@context.Count" Width="100" Sortable="true" />
        </TableColumns>
    </Table>
</DemoBlock>

<DemoBlock Title="@FilterLocalizer["SetFilterInCodeTitle"]" Introduction="@FilterLocalizer["SetFilterInCodeIntro"]" Name="SetFilterInCode">
    <div class="mb-2">
        <Button Text="@FilterLocalizer["SetFilterInCodeButtonText1"]" OnClickWithoutRender="SetFilterInCode" />
        <Button Text="@FilterLocalizer["SetFilterInCodeButtonText2"]" OnClickWithoutRender="ResetAllFilters" />
    </div>
    <Table TItem="Foo" @ref="TableSetFilter"
           IsPagination="true" PageItemsSource="@PageItemsSource"
           IsStriped="true" IsBordered="true" IsMultipleSelect="true"
           ShowSkeleton="true" ShowFilterHeader="true"
           OnQueryAsync="@OnQueryAsync">
        <TableColumns>
            <TableColumn @bind-Field="@context.DateTime" Width="180" Sortable="true" />
            <TableColumn @bind-Field="@context.Name" Width="100" Sortable="true" Filterable="true" />
            <TableColumn @bind-Field="@context.Address" Sortable="true" />
            <TableColumn @bind-Field="@context.Complete" Width="100" Sortable="true" Filterable="true" />
            <TableColumn @bind-Field="@context.Education" Width="100" Sortable="true" Filterable="true" />
            <TableColumn @bind-Field="@context.Count" Width="150" Sortable="true" />
        </TableColumns>
    </Table>
</DemoBlock>
